<!DOCTYPE html>
<html>
<head>
  <meta charset="utf-8">
  <title>淘宝助手</title>
  <meta name="renderer" content="webkit">
  <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
  <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
  {include file="public/css"/}
</head>
<body>
  <div class="layui-fluid">
    <div class="layui-row layui-col-space15">
      <div class="layui-card layui-col-md12">
				<div class="layui-card-header">
					<div class="layui-tab layui-tab-brief">
						<ul class="layui-tab-title">
							<li {if input('param.type')==0}class="layui-this"{/if} onclick="location.href='{:url('index')}'">淘宝</li>
							<li {if input('param.type')=='1'}class="layui-this"{/if} onclick="location.href='{:url('index')}/type/1'">天猫</li>
							<li {if input('param.type')=='2'}class="layui-this"{/if} onclick="location.href='{:url('index')}/type/2'">京东</li>
							<!-- <li {if input('param.type')=='3'}class="layui-this"{/if} onclick="location.href='{:url('index')}/type/3'">拼多多</li> -->
							<li {if input('param.type')=='4'}class="layui-this"{/if} onclick="location.href='{:url('index')}/type/4'">阿里巴巴</li>
						</ul>
					</div>
					{if input('param.isopen')==1}<i class="layui-icon layui-icon-close" style="font-size:18px;font-weight:bold;cursor:pointer" onclick="closeself()"></i>{/if}
				</div>
				<div class="layui-card-body" pad15>
					<blockquote class="layui-elem-quote">填写商品链接，点击提交即可自动添加淘宝商品到商品列表；由于采集数据的不确定性，并非所有商品都能获取到，如获取失败请手动添加，如数据存在偏差请手动修改</blockquote>
					<div class="layui-form form-label-w8" lay-filter="">
						<div class="layui-form-item">
							<label class="layui-form-label">99APIKEY：</label>
							<div class="layui-input-inline" style="width:600px">
								<input type="text" name="apikey" value="{$apikey}" lay-verify="required" lay-verType="tips" class="layui-input">
							</div>
							<div class="layui-form-mid layui-word-aux layui-clear">99api接口密钥，没有注册请先注册 <a href="https://www.99api.com/Login?log=5&referee=5929" target="_blank">前往注册</a>，注册完成后需要在我的数据接口中点击添加接口添加[淘宝API][天猫API][京东商城API][1688阿里巴巴API]</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label">商品ID或商品链接：</label>
							<div class="layui-input-inline" style="width:600px">
								<input type="text" name="taobaourl" value="" lay-verify="required" lay-verType="tips" autocomplete="off" class="layui-input">
							</div>
							<div class="layui-form-mid layui-word-aux layui-clear">商品ID在商品链接中查找</div>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"></label>
						</div>
						<div class="layui-form-item">
							<label class="layui-form-label"></label>
							<div class="layui-input-block">
								<button class="layui-btn" lay-submit lay-filter="formsubmit">提 交</button>
							</div>
						</div>
					</div>
				</div>
			</div>
		</div>
  </div>
	{include file="public/js"/}
	<script>
	layui.form.on('submit(formsubmit)', function(obj){
		var field = obj.field
		var index = layer.load();
		$.post('',field,function(data){
			layer.close(index);
			if(data.status == 1){
				layer.confirm('添加完成，是否前去编辑？', {icon: 1, title:'提示',btn:['是','否']}, function(index){
					layer.close(index);
					openmax("{:url('ShopProduct/edit')}/id/"+data.proid);
				},function(index){
					layer.close(index);
					location.href = location.href;
				});
			}else{
				dialog(data.msg,data.status);
			}
		})
	})
  </script>
</body>
</html>